home *** CD-ROM | disk | FTP | other *** search
- #!/usr/local/bin/perl
-
- use CGI qw/:standard :escape :unescape/;
-
- $mailprog = '/bin/sendmail';
-
- $reg_url = 'http://www.3d3.com/encrypt/regdb_register.cgi';
-
- $email_alert = 'tech@3d3.com'; # email in case of fatal error
-
- $def_bgcolor = "#ffffd0"; # default body colors
- $def_link_color ="#0033cc";
- $def_vlink_color ="#0033cc";
- $def_alink_color ="#cc3333";
- $def_text_color ="#000000";
-
- &get_body_attributes;
-
- # Start returning a page...
- print "Content-type: text/html\n\n";
-
- # check required fields
- &check_required;
-
- my($code) = param('code'); # code if entered in registration screen by user
- if($code eq ' ') { $code = ''; }
- my($email) = param('email'); # email if entered in registration screen by user
- if($email eq ' ') { $email = ''; }
- my($product) = param('product'); # product eg: Lite, Pro, Developer
- my($version) = param('version'); # major version eg: 4 for 4.40
- my($mversion) = param('mversion'); # minor version eg: 40 for 4.40
- my($language) = param('language'); # language eg: English, German, Japanese
- my($unlocker) = param('unlocker'); # unlock code generator: eg: slgen, sswrap.
- # these are defined in regdb_register.cgi
- # print the body...
- my($body) =<<"__EOHTML__";
- <script language="JavaScript">
- <!--
- function validateForm()
- {
- var errStr = "The following fields require values:\\n";
- var bOk = true;
- if(document.forms[0].email.value.indexOf("\@") == -1) {
- errStr += "E-Mail\\n";
- bOk = false;
- }
- if(document.forms[0].confirm_email.value.indexOf("\@") == -1) {
- errStr += "E-Mail (confirm)\\n";
- bOk = false;
- }
- if(document.forms[0].code.value=="") {
- errStr += "Code\\n";
- bOk = false;
- }
- if(!bOk) {
- alert(errStr);
- } else {
- if(document.forms[0].email.value != document.forms[0].confirm_email.value) {
- alert("'E-Mail' and 'E-Mail (confirm)' do not match!");
- bOk = false;
- }
- }
- return(bOk);
- }
-
- //-->
- </script>
- <form action="$reg_url" method="post" onSubmit="return(validateForm());">
- <input type="hidden" name="bgcolor" value="$def_bgcolor">
- <input type="hidden" name="text_color" value="$def_text_color">
- <input type="hidden" name="link_color" value="$def_link_color">
- <input type="hidden" name="vlink_color" value="$def_vlink_color">
- <input type="hidden" name="alink_color" value="$def_alink_color">
- <input type="hidden" name="product" value="$product">
- <input type="hidden" name="version" value="$version">
- <input type="hidden" name="mversion" value="$mversion">
- <input type="hidden" name="language" value="$language">
- <input type="hidden" name="unlocker" value="$unlocker">
- <center>
- <table border="1" cellpadding="2" bgcolor="#ffef90">
- <tr>
- <td>
- <font face="Arial, Helvetica">E-Mail:</font>
- </td>
- <td>
- <input type="text" size="35" maxlength="100" name="email" value="$email">
- </td>
- </tr>
- <tr>
- <td>
- <font face="Arial, Helvetica">E-Mail (confirm):</font>
- </td>
- <td>
- <input type="text" size="35" maxlength="100" name="confirm_email" value="$email">
- </td>
- </tr>
- <tr>
- <td>
- <font face="Arial, Helvetica">Code:</font>
- </td>
- <td>
- <input type="text" size="35" name="code" value="$code">
- </td>
- </tr>
- </table>
-
- <br>
-
- <input type="submit" value="Send"> <input type="reset" value="Clear">
- </center>
- </form>
- __EOHTML__
-
- &print_html("Please fill in the form below to register your copy of ShopFactory.", $body);
-
-
- sub check_required {
-
- if( (!(param('product')) || param('product') eq ' ') ||
- (!(param('version')) || param('version') eq ' ') ) {
-
- # product or version does not exist
-
- my($errmsg) =<<"__EOERR__";
- <p>The Product Name and Version information could not be correctly determined.</p>
-
- <p>If you manually entered the URL http://www.3d3.com/encrypt/register.cgi,
- please press the "Register" button on the ShopFactory start up screen
- instead of doing this.</p>
- __EOERR__
-
- &print_html("Error: Can't determine Product and Version", $errmsg);
- &send_error_report('Product and/or Version not specified');
-
- exit;
- }
- }
-
- sub send_error_report {
- my($error) = @_;
- my($body);
-
- $body = "$date\n";
- $body .= "Error: $error\n";
-
- $body .= "\n----- Param Info -----\n\n";
-
- my (@names) = param;
- for $name (@names) {
- $body .= "$name = " . param($name) . "\n";
- }
-
- $body .= "\n----- UA Info -----\n\n";
- $body .= "Browser: $ENV{'HTTP_USER_AGENT'}\n";
- $body .= "Remote Host: $ENV{'REMOTE_HOST'}\n";
- $body .= "Remote Address: $ENV{'REMOTE_ADDR'}\n";
-
- &sendmail($email_alert,
- "\"register.cgi\" <$email_alert>",
- "register.cgi error!",
- $body);
- }
-
- sub print_html {
- my($title, $desc) = @_;
-
- print "<html>\n<body";
- print " bgcolor=\"$def_bgcolor\" link=\"$def_link_color\" vlink=\"$def_vlink_color\" alink=\"$def_alink_color\" text=\"$def_text_color\"";
- print ">\n";
-
- print <<"__EOHTML__";
- <center>
- <table border="0" cellpadding="0" cellspacing="0" width="540">
- <tr>
- <td>
- <font face="Arial, Helvetica">
- <center><h4>$title</h4></center>
- $desc
- </font>
- </td>
- </tr>
- </table>
- </center>
- </body>
- </html>
- __EOHTML__
- }
-
- sub get_body_attributes {
- if (param('bgcolor')) {
- $def_bgcolor = param('bgcolor');
- }
- if (param('link_color')) {
- $def_link_color = param('link_color');
- }
- if (param('vlink_color')) {
- $def_vlink_color = param('vlink_color');
- }
- if (param('alink_color')) {
- $def_alink_color = param('alink_color');
- }
- if (param('text_color')) {
- $def_text_color = param('text_color');
- }
- }
-
- sub sendmail {
- my($to, $from, $subject, $body) = @_;
-
- open (MAIL, "|$mailprog -t -oi") || return 0;
- print MAIL "To: $to\n";
- print MAIL "From: $from\n";
- print MAIL "Subject: $subject\n\n";
- print MAIL "$body\n";
- close MAIL;
- return 1;
- }